<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MCSManager 节点列表</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', sans-serif;
            background: #f5f6fa;
            padding: 20px;
            color: #2c3e50;
        }

        .container {
            max-width: 800px;
            margin: 0 auto;
            background: white;
            border-radius: 10px;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
            padding: 20px;
        }

        .header {
            text-align: center;
            padding-bottom: 15px;
            margin-bottom: 20px;
            border-bottom: 1px solid #eee;
        }

        .header h1 {
            color: #34495e;
            font-size: 20px;
        }

        .node-list {
            display: grid;
            gap: 15px;
        }

        .node-card {
            position: relative;
            background: #fff;
            border-radius: 8px;
            border: 1px solid #eee;
        }

        .node-header {
            display: flex;
            align-items: center;
            padding: 15px;
            gap: 12px;
        }

        .node-number {
            width: 24px;
            height: 24px;
            background: #34495e;
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            font-weight: bold;
        }

        .node-icon {
            width: 36px;
            height: 36px;
            background: #3498db;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
        }

        .node-info {
            flex: 1;
        }

        .node-name {
            font-size: 16px;
            font-weight: bold;
            color: #2c3e50;
            margin-bottom: 4px;
        }

        .node-id {
            font-size: 12px;
            color: #95a5a6;
        }

        .status-badge {
            padding: 4px 12px;
            border-radius: 4px;
            font-size: 12px;
        }

        .status-online {
            background: #e8f5e9;
            color: #2e7d32;
        }

        .status-offline {
            background: #ffebee;
            color: #c62828;
        }

        .node-details {
            padding: 12px 15px;
            background: #f8f9fa;
            border-top: 1px solid #eee;
        }

        .info-grid {
            display: grid;
            grid-template-columns: auto 1fr auto 1fr;
            gap: 12px;
            align-items: center;
        }

        .info-label {
            color: #7f8c8d;
            font-size: 13px;
        }

        .info-value {
            color: #34495e;
            font-size: 13px;
        }

        .instance-list {
            margin-top: 12px;
            border-top: 1px solid #eee;
            padding-top: 12px;
        }

        .instance-item {
            display: flex;
            align-items: center;
            padding: 8px 0;
        }

        .instance-name {
            flex: 1;
            font-size: 13px;
            color: #34495e;
        }

        .instance-type {
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 12px;
            margin: 0 12px;
        }

        .type-minecraft {
            background: #e8f5e9;
            color: #2e7d32;
        }

        .type-universal {
            background: #e3f2fd;
            color: #1565c0;
        }

        .instance-status {
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 12px;
        }

        .status-running {
            background: #e8f5e9;
            color: #2e7d32;
        }

        .status-stopped {
            background: #ffebee;
            color: #c62828;
        }

        .footer {
            margin-top: 20px;
            text-align: center;
            color: #95a5a6;
            font-size: 12px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>MCSManager 节点列表 (共{{total}}个节点)</h1>
        </div>

        <div class="node-list">
            {{each nodes node index}}
            <div class="node-card">
                <div class="node-header">
                    <div class="node-number">{{index+1}}</div>
                    <div class="node-icon">💻</div>
                    <div class="node-info">
                        <div class="node-name">{{node.name}}</div>
                        <div class="node-id">ID: {{node.daemonId}}</div>
                    </div>
                    <div class="status-badge {{node.status ? 'status-online' : 'status-offline'}}">
                        {{node.status ? '在线' : '离线'}}
                    </div>
                </div>

                <div class="node-details">
                    <div class="info-grid">
                        <div class="info-label">端口</div>
                        <div class="info-value">{{node.port}}</div>
                        <div class="info-label">实例数量</div>
                        <div class="info-value">{{node.instanceCount}}</div>
                    </div>

                    {{if node.instances.length > 0}}
                    <div class="instance-list">
                        {{each node.instances inst}}
                        <div class="instance-item">
                            <span class="instance-name">{{inst.name}}</span>
                            <span class="instance-type {{inst.type === 'minecraft/java' ? 'type-minecraft' : 'type-universal'}}">
                                {{inst.type}}
                            </span>
                            <span class="instance-status {{getStatusClass(inst.status)}}">
                                {{getStatusText(inst.status)}}
                            </span>
                        </div>
                        {{/each}}
                    </div>
                    {{/if}}
                </div>
            </div>
            {{/each}}
        </div>

        <div class="footer">
            Generated by Yunzai-Bot MCSManager Plugin
        </div>
    </div>
</body>
</html>
